import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home.vue'
import indexChildren from './findMusic/index'

const routes = [
  {
    path: '/:pathMatch(.*)*',
    register: "/"
  },
  {
    path: '/',
    name: 'Home',
    component: Home,
    children: [
      {
        path: '/',
        name: 'Index',
        component: () => import('@/views/Index/index.vue'),
        children: indexChildren,
        meta: {
          title: '发现音乐'
        }
      },
      {
        path: '/songSheetDetail/:id',
        name: 'SongSheetDetail',
        component: () => import('@/views/songSheetDetail/songSheetDetail.vue'),
        meta: {
          title: '歌单详情'
        }
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/Login/login.vue'),
    meta: {
      title: '登录'
    }
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
